package com.machine.action.tree;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.bean.Tree;
import com.machine.service.tree.TreeServer;
import com.opensymphony.xwork2.ActionSupport;

@Component("treeAction")
@Scope("prototype")
public class TreeAction extends ActionSupport {
	private static final long serialVersionUID = 1L;

	private TreeServer treeServerImpl;

	public TreeServer getTreeServer() {
		return treeServerImpl;
	}

	@Resource
	public void setTreeServer(TreeServer treeServer) {
		this.treeServerImpl = treeServer;
	}

	@Override
	public String execute() throws Exception {
		List<Tree> beans = treeServerImpl.getBeans();
		for(Tree b : beans){
			System.out.println(b.getName());
		}
		return null;
	}
}
